import request from '@/utils/request'
const portalCode = process.env.VUE_APP_PORTALCODE

// 获取消息条数
export function getCountNumber() {
  return request({
    url: '/ucenter/api/index/countSum',
    method: 'get'
  })
}

// 顶部系统通知
export function headerNotice() {
  return request({
    url: '/mcenter/api/notice/v1/notice/getNoticeByPortalCode',
    method: 'get',
    params: { portalCode }
  })
}
// 全部设为已读
export function clearNoticeNotRead() {
  return request({
    url: '/mcenter/api/notice/v1/notice/updateNoticeToIsReadAllByPortalCode',
    method: 'put',
    params: { portalCode }
  })
}

// 顶部系统已读
export function headerNoticeRead(id) {
  return request({
    url: `/ucenter/api/message/read/${id}`,
    method: 'put'
  })
}

// 顶部最近访问
export function headerLately(data) {
  return request({
    url: `'/ucenter/api/menu/listVisitMenus`,
    method: 'get',
    params: data
  })
}

// 获取收藏菜单
export function headerFavorite(data) {
  return request({
    url: `/ucenter/api/v2/userCollectMenu/page`,
    method: 'get',
    params: data
  })
}

// 删除收藏菜单
export function delheaderFavorite(menuId) {
  return request({
    url: `/ucenter/api/v2/userCollectMenu/${menuId}`,
    method: 'delete'
  })
}

/* 菜单收藏操作 */
export function addheaderFavorite(menuId) {
  return request({
    url: `/ucenter/api/v2/userCollectMenu`,
    method: 'post',
    data: { menuId }
  })
}
/* 菜单收藏操作 */
